package com.example.anno.ioc;

import com.example.anno.entity.RainBow;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

public class RainBowImportDefinitionRegistry implements ImportBeanDefinitionRegistrar {
    @Override
    public void registerBeanDefinitions(AnnotationMetadata meta, BeanDefinitionRegistry registry) {
        registry.registerBeanDefinition("rainBow",
                BeanDefinitionBuilder.genericBeanDefinition(RainBow.class)
                        .setScope(ConfigurableBeanFactory.SCOPE_SINGLETON)
                        .getBeanDefinition());
    }
}
